home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / tkern10.zip / SRC\TFILE.C < prev    next >
Text File  |  1994-02-13  |  2KB  |  93 lines

  1. /*
  2.  *  This file forms part of "TKERN" - "Troy's Kernel for Windows".
  3.  *
  4.  *  Copyright (C) 1994  Troy Rollo <troy@cbme.unsw.EDU.AU>
  5.  *
  6.  *  This library is free software; you can redistribute it and/or
  7.  *  modify it under the terms of the GNU Library General Public
  8.  *  License as published by the Free Software Foundation; either
  9.  *  version 2 of the License, or (at your option) any later version.
  10.  *
  11.  *  This library is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  *  Library General Public License for more details.
  15.  *
  16.  *  You should have received a copy of the GNU Library General Public
  17.  *  License along with this library; if not, write to the Free
  18.  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. #include <fcntl.h>
  22. #include <errno.h>
  23. #include <io.h>
  24.  
  25. extern    int    nError;
  26.  
  27. int
  28. file_open(    char const *pchFile,
  29.         int    nMode,
  30.         int    nAccess)
  31. {
  32.     int    nResult;
  33.  
  34.     nResult = open(pchFile, nMode, nAccess);
  35.     nError = errno;
  36.     return nResult;
  37. }
  38.  
  39. int
  40. file_close(    int    id)
  41. {
  42.     int    nResult;
  43.  
  44.     nResult = close(id);
  45.     nError = errno;
  46.     return nResult;
  47. }
  48.  
  49. long
  50. file_seek(    int    id,
  51.         long    nPosition,
  52.         int    nStart)
  53. {
  54.     long    nResult;
  55.  
  56.     nResult = lseek(id, nPosition, nStart);
  57.     nError = errno;
  58.     return nResult;
  59. }
  60.  
  61. int
  62. file_read(    int    id,
  63.         char    *pchData,
  64.         int    nBytes)
  65. {
  66.     int    nResult;
  67.  
  68.     nResult = read(id, pchData, nBytes);
  69.     nError = errno;
  70.     return nResult;
  71. }
  72.  
  73. int
  74. file_write(    int    id,
  75.         char    const    *pchData,
  76.         int    nBytes)
  77. {
  78.     int    nResult;
  79.  
  80.     nResult = write(id, pchData, nBytes);
  81.     nError = errno;
  82.     return nResult;
  83. }
  84.  
  85. int
  86. file_ioctl(void)
  87. {
  88.     nError = EINVAL;
  89.     return -1;
  90. }
  91.  
  92.  
  93.